home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigantic Games 2
/
Gigantic Games 2.iso
/
pc
/
_r_
/
rocky
/
b.macros
< prev
next >
Wrap
Text File
|
1994-12-23
|
4KB
|
312 lines
*******************************************************************
* MACROS FOR EASY ACCESS TO SURROUNDING CELLS IN 2-D ARRAY
*
* A1 -> cell map
* A2 -> parallel flags map
* D7 = SCRATCH REGISTER
*******************************************************************
*
* COMPARE CONSTANT e.g. COMP_D AIR (read: compare down air)
*
* U/R/D/L (Up,Right,Down,Left)
COMP_U MACRO
cmp.b #\1,-COLUMNS(a1)
ENDM
COMP_R MACRO
cmp.b #\1,1(a1)
ENDM
COMP_D MACRO
cmp.b #\1,COLUMNS(a1)
ENDM
COMP_L MACRO
cmp.b #\1,-1(a1)
ENDM
COMP_RR MACRO
cmp.b #\1,2(a1)
ENDM
COMP_LL MACRO
cmp.b #\1,-2(a1)
ENDM
*
* COMPARE CONSTANT
*
* DIAGONALS
COMP_UR MACRO
cmp.b #\1,-COLUMNS+1(a1)
ENDM
COMP_UL MACRO
cmp.b #\1,-COLUMNS-1(a1)
ENDM
COMP_DR MACRO
cmp.b #\1,COLUMNS+1(a1)
ENDM
COMP_DL MACRO
cmp.b #\1,COLUMNS-1(a1)
ENDM
*
* COMPARE CONSTANT MASKED e.g. COMPM_R MASK4,FROCK
*
* U/R/D/L
COMPM_U MACRO
moveq #\1,d7
and.b -COLUMNS(a1),d7
cmp.b #\2,d7
ENDM
COMPM_R MACRO
moveq #\1,d7
and.b 1(a1),d7
cmp.b #\2,d7
ENDM
COMPM_D MACRO
moveq #\1,d7
and.b COLUMNS(a1),d7
cmp.b #\2,d7
ENDM
COMPM_L MACRO
moveq #\1,d7
and.b -1(a1),d7
cmp.b #\2,d7
ENDM
*
* COMPARE REGISTER MASKED e.g. CMPMR_U MASK4,D0
*
* U/R/D/L
CMPMR_U MACRO
moveq #\1,d7
and.b -COLUMNS(a1),d7
cmp.b \2,d7
ENDM
CMPMR_R MACRO
moveq #\1,d7
and.b 1(a1),d7
cmp.b \2,d7
ENDM
CMPMR_D MACRO
moveq #\1,d7
and.b COLUMNS(a1),d7
cmp.b \2,d7
ENDM
CMPMR_L MACRO
moveq #\1,d7
and.b -1(a1),d7
cmp.b \2,d7
ENDM
*
* COMPARE REG/REG MASKED e.g. CPMRR_U d1,D0
* d1 is mask
* U/R/D/L
CPMRR_U MACRO
move.b -COLUMNS(a1),d7
and.b \1,d7
cmp.b \2,d7
ENDM
CPMRR_R MACRO
move.b 1(a1),d7
and.b \1,d7
cmp.b \2,d7
ENDM
CPMRR_D MACRO
move.b COLUMNS(a1),d7
and.b \1,d7
cmp.b \2,d7
ENDM
CPMRR_L MACRO
move.b -1(a1),d7
and.b \1,d7
cmp.b \2,d7
ENDM
*
* SET A CEL CONSTANT
*
* CURRENT U/R/D/L
SETCEL MACRO
move.b #\1,(a1)
st (a2)
ENDM
SET_U MACRO
move.b #\1,-COLUMNS(a1)
st -COLUMNS(a2)
ENDM
SET_R MACRO
move.b #\1,1(a1)
st 1(a2)
ENDM
SET_D MACRO
move.b #\1,COLUMNS(a1)
st COLUMNS(a2)
ENDM
SET_L MACRO
move.b #\1,-1(a1)
st -1(a2)
ENDM
*
* SET A CEL CONSTANT
*
* DIAGONALS
SET_UR MACRO
move.b #\1,-COLUMNS+1(a1)
st -COLUMNS+1(a2)
ENDM
SET_UL MACRO
move.b #\1,-COLUMNS-1(a1)
st -COLUMNS-1(a2)
ENDM
SET_DR MACRO
move.b #\1,COLUMNS+1(a1)
st COLUMNS+1(a2)
ENDM
SET_DL MACRO
move.b #\1,COLUMNS-1(a1)
st COLUMNS-1(a2)
ENDM
*
* COMPARE REGISTER
*
* U/R/D/L
COMPR_U MACRO
cmp.b -COLUMNS(a1),\1
ENDM
COMPR_R MACRO
cmp.b 1(a1),\1
ENDM
COMPR_D MACRO
cmp.b COLUMNS(a1),\1
ENDM
COMPR_L MACRO
cmp.b -1(a1),\1
ENDM
*
* COMPARE REGISTER
*
* DIAGONALS
COMPR_UR MACRO
cmp.b -COLUMNS+1(a1),\1
ENDM
COMPR_UL MACRO
cmp.b -COLUMNS-1(a1),\1
ENDM
COMPR_DR MACRO
cmp.b COLUMNS+1(a1),\1
ENDM
COMPR_DL MACRO
cmp.b COLUMNS-1(a1),\1
ENDM
************************************************************************
SETCELR MACRO
move.b \1,(a1)
st (a2)
ENDM
SETR_R MACRO
move.b \1,1(a1)
st 1(a2)
ENDM
SETR_L MACRO
move.b \1,-1(a1)
st -1(a2)
ENDM
SETR_D MACRO
move.b \1,COLUMNS(a1)
st COLUMNS(a2)
ENDM
SETR_U MACRO
move.b \1,-COLUMNS(a1)
st -COLUMNS(a2)
ENDM
SETR_RR MACRO
move.b \1,2(a1)
st 2(a2)
ENDM
SETR_LL MACRO
move.b \1,-2(a1)
st -2(a2)
ENDM
************************************************************************
SETR_UR MACRO
move.b \1,-COLUMNS+1(a1)
st -COLUMNS+1(a2)
ENDM
SETR_UL MACRO
move.b \1,-COLUMNS-1(a1)
st -COLUMNS-1(a2)
ENDM
SETR_DR MACRO
move.b \1,COLUMNS+1(a1)
st COLUMNS+1(a2)
ENDM
SETR_DL MACRO
move.b \1,COLUMNS-1(a1)
st COLUMNS-1(a2)
ENDM
************************************************************************
* AUTOMATIC ANIMATION e.g. NEXCELL MASK4,GEGG
************************************************************************
NEXCELL MACRO
moveq #(-(\1))-1,d7
move.w d0,d6
addq.w #1,d6
and.w d6,d7
or.w #\2,d7
SETCELR D7
ENDM